package util;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

class Object {
    byte[] bytes = new byte[64 * 1024]; // 64k
}

/**
 * -Xmx100m -Xms100m -XX:+PrintGCDetails -XX:+UseSerialGC
 */
public class JConsole {

    static void test(int n) {
        List<Object> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(new Object());
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        list = null;
        System.gc();
    }

    public static void main(String[] args) {
        test(1000);
    }
}
